<template>
  <div id="nav">
    <!-- 在vue-router4.x 之后废弃了 tag 有了v-solt 概念 -->
    <router-link custom to="/" v-slot="{ navigate,isExactActive }">
      <span @click="navigate" :class="{ active: isExactActive }">home</span>
    </router-link>
    |
    <!-- v-slot 还可以简写成 # -->
    <router-link custom to="/about" v-slot="{ navigate,isExactActive }">
      <span @click="navigate" :class="{ active: isExactActive }">about</span>
    </router-link>
  </div>
  <router-view />
</template>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

#nav {
  padding: 30px;
  .active {
    color: red;
  }
  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
